<template>
    <el-table
            size="small"
            :data="tableData"
            stripe
            show-summary
            :summary-method="getSummaries"
            border
            @selection-change="handleSelectionChange"
            style="width: 100%">
        <el-table-column
                type="selection"
                fixed="left"
                width="60">
        </el-table-column>
        <el-table-column
                type="index"
                label="序号"
                width="50">
        </el-table-column>
        <el-table-column
                prop="phone"
                min-width="100"
                label="手机号码">
        </el-table-column>
        <el-table-column
                prop="likeCnt"
                label="点赞">
        </el-table-column>
        <el-table-column
                prop="commentCnt"
                label="评论">
        </el-table-column>
        <el-table-column
                prop="attentionCnt"
                label="关注">
        </el-table-column>
        <el-table-column
                prop="registerTime"
                label="私信">
        </el-table-column>
        <el-table-column
                prop="proxyIp"
                label="IP">
        </el-table-column>
        <el-table-column
                prop="lastLoginTime"
                label="最后一次登录时间">
        </el-table-column>
<!--        <el-table-column-->
<!--                width="200"-->
<!--                label="操作">-->
<!--            <template v-slot="scope">-->
<!--                <el-button type="text" size="small" @click="handleDetails(scope.row)">详情</el-button>-->
<!--            </template>-->
<!--        </el-table-column>-->
    </el-table>
</template>

<script>
  export default {
    name: "tableList",
    props: {
      tableData: Array
    },
    data() {
      return {
        currentSelection: []
      }
    },
    methods: {
      handleDetails (row) {
        this.$router.push({
          path: '/userDetail',
          query: {
            id: row.userId
          }
        })
      },
      getSummaries (param) {
        const { columns, data } = param;
        const sums = [];
        columns.forEach((item, index) =>{
          if (index === 0) {
            sums[index] = '小计';
            return;
          }
          if(index === 1) {
            sums[index] = data.length
            return;
          }
          sums[index] = '-'
        })
        return sums
      },
      handleSelectionChange(val) {
        this.currentSelection = val;
        this.$store.dispatch('user/setSelection', val)
      }
    }
  }
</script>

<style scoped>

</style>
